﻿(function($){
	$.fn.serializeJson=function(){  
	    var serializeObj={};  
	    var array=this.serializeArray();  
	    var str=this.serialize();  
	    $(array).each(function(){  
	        if(serializeObj[this.name]){  
	            if($.isArray(serializeObj[this.name])){  
	                serializeObj[this.name].push(this.value);  
	            }else{  
	                serializeObj[this.name]=[serializeObj[this.name],this.value];  
	            }  
	        }else{  
	            serializeObj[this.name]=this.value;   
	        }  
	    });  
	};
})(jQuery); 
var DB = {};
DB.Json = (function(){
	var rpcCall = function(dataobj,defUrl){
		var defaultUrl = defUrl;		
		var result = "";
	  	jQuery.ajax({type:"post",async:false,url:defaultUrl,data:dataobj,success:
	  		function(data){
	        	result = data;	        	
	    	}
	    });	    
		return result;	
	};	
	var OpData = {	
		getMeeting:function(userid){
			var paramObj = {userid};
			var rslt = rpcCall(paramObj,getMeeting);
			var data = rslt;
			return data;
		}
	};
    return OpData;//生成公有静态元素
})();


function getUrlParam(name){
	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if (r!=null){
		return unescape(r[2]);
	}else{
		return null;
	}	
}

function getJsonLength(json){
	var len=0;
	if(Boolean(json)){
		for(i in json)len++;
	}
	return len;
}

function URLencode(sStr){
   return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\''/g, '%27').replace(/\//g,'%2F');
}
